package main

import (
	"github.com/kataras/iris/v12"
	"github.com/kataras/iris/v12/mvc"
	"github.com/micro/go-micro/v2/web"
	"github.com/micro/go-plugins/registry/etcdv3/v2"
	_ "gomicro/httpMicro/httpServer/dao"
	"gomicro/httpMicro/httpServer/handler"
	"log"
)

func main() {

	etcdRegistry := etcdv3.NewRegistry()
	
	service := web.NewService(
		web.Name("go.httpmicro.api.student.server"),
		web.Registry(etcdRegistry),
	)
	
	// //服务初始化
	service.Init()
	
	app := iris.New()
	mvc.New(app).Handle(new(handler.StudentHandlerCuda))
	app.Run(iris.Addr(":4040"))

	service.Handle("/", app)

	err := service.Run()
	if err != nil {
		log.Fatal(err)
	}
}